package com.project.server.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import com.project.server.model.OrderDetail;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("orders")
@Schema(description = "订单信息")
public class Order {

    @TableId(type = IdType.AUTO)
    @Schema(description = "ID")
    private Long id;

    @Schema(description = "订单号")
    private String orderNo;

    @Schema(description = "用户ID")
    private Long userId;

    @Schema(description = "餐厅ID")
    private Long restaurantId;

    @Schema(description = "餐厅名称")
    @TableField(exist = false)
    private String restaurantName;

    @Schema(description = "餐桌ID")
    private Long tableId;

    @Schema(description = "餐桌编号")
    @TableField(exist = false)
    private String tableNumber;

    @Schema(description = "订单总金额")
    private BigDecimal totalAmount;

    @Schema(description = "联系人")
    private String contactName;

    @Schema(description = "联系电话")
    private String contactPhone;

    @Schema(description = "用餐人数")
    private Integer personCount;

    @Schema(description = "预订时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime reservationTime;

    @Schema(description = "备注")
    private String remark;

    @Schema(description = "状态：0-待确认 1-已确认 2-已取消 3-已完成")
    private Integer status;

    @Schema(description = "订单明细")
    @TableField(exist = false)
    private List<OrderDetail> orderDetails;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;
} 